var applicationManageApp = new Vue({
    el: '#applicationManageApp',
    data: {
        applicationList: [] // 公司应用数组
    },
    mounted:  function(){
        this.initData()
    },
    methods: {
        /**
         * 初始化数据
         */
        initData: function() {
            this.getApplicationList()
        },
        /**
         * 获取应用列表
         */
        getApplicationList: function() {
            var _self = this
            VUE_UTIL.getAxiosInstance().get('/account/queryAppList')
                .then(function(response){
                    _self.applicationList = response.data.data
                })
        },
        /**
         * 改变应用状态
         * @param app
         */
        changeStatus: function(app) {
            var _self = this
            var postData = {
                id: app.id,
                on: app.status,
            }
            VUE_UTIL.getAxiosInstance().post("/account/company/appOnOff",VUE_UTIL.buildPostFormData(postData))
                .then(function(response){
                    console.log(response.data.success)
                    if (response.data.success == true){
                        layer.msg('修改成功', {time: 1000})
                        _self.getApplicationList()
                    } else {
                        layer.msg('修改失败', {time: 1000})
                    }
                })

        }
    },
})